<form name="frmCode" class="form-horizontal" ng-init="dvm.init()" ng-submit="dvm.insert(frmCode.$valid)" novalidate>
  <div class="modal-header">
    <button type="button" class="close" ng-click="dvm.cancel()">&times;</button>
    <h4 class="modal-title">代码</h4>
  </div>
  <div class="modal-body">
    <div class="form-group">
      <div class="col-sm-12">
        <div class="input-group col-sm-12">
          <div ng-if="!dvm.customized">
            <select name="language" class="form-control" ng-model="dvm.language" required autofocus
                ng-options="language.value as language.label for language in dvm.languages"></select>
          </div>
          <div ng-if="dvm.customized">
            <input type="text" name="language" class="form-control" ng-model="dvm.language" required autofocus
                ng-class="{'x-invalid': frmCode.$submitted && frmCode.language.$invalid}">
          </div>
          <span class="input-group-addon">
            <label class="checkbox-inline"><input type="checkbox" ng-model="dvm.customized">自定义语言</label>
          </span>
        </div>
        <p class="text-danger" ng-show="frmCode.$submitted && frmCode.language.$error.required">代码语言不能为空</p>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-12" ng-class="{'x-full-screen x-frame': dvm.fullScreen}">
        <div class="x-editor">
          <pre id="code-editor" style="height:360px"></pre>
        </div>
      </div>
    </div>
  </div>
  <div class="modal-footer">
    <button type="submit" class="btn btn-primary" ng-disabled="frmCode.$invalid">插入</button>
    <button type="button" class="btn btn-default" ng-click="dvm.cancel()">取消</button>
  </div>
  <script type="text/ng-template" id="code-editor-tools">
    <div class="x-editor-tool">
      <div class="x-toolbar btn-group">
        <button type="button" class="btn btn-default btn-xs" ng-click="dvm.fullScreen = !dvm.fullScreen"
            title="{{dvm.fullScreen ? '退出全屏' : '全屏'}}">
          <i class="fa" ng-class="{'fa-compress': dvm.fullScreen, 'fa-expand': !dvm.fullScreen}"></i></button>
      </div>
    </div>
  </script>
</form>
